package com.example.smartcity.ui.Adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.smartcity.R;
import com.example.smartcity.ui.Bean.DelivaryMessageBean;

import java.util.List;

public class DelivaryListViewAdapter extends ArrayAdapter<DelivaryMessageBean> {
    int resource;
    public DelivaryListViewAdapter(@NonNull Context context, int resource, @NonNull List<DelivaryMessageBean> objects) {
        super(context, resource, objects);
        this.resource = resource;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        DelivaryMessageBean bean = getItem(position);
        @SuppressLint("ViewHolder") View view = LayoutInflater.from(parent.getContext()).inflate(resource,parent,false);
        TextView TVStoreName = view.findViewById(R.id.TV_StoreName);
        TextView TVStoreAddress = view.findViewById(R.id.TV_StoreAddress);
        TextView TVPhone = view.findViewById(R.id.TV_phone);
        TVStoreName.setText(bean.getStoreName());
        TVStoreAddress.setText(bean.getAddress());
        TVPhone.setText(bean.getPhone());
        return view;
    }
}
